package com.ecy.quadratic.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.ecy.quadratic.R;
import com.ecy.quadratic.beans.user.User;
import com.ecy.quadratic.manager.LoginManager;
import com.ecy.quadratic.reader.base.BaseActivity;
import com.ecy.quadratic.reader.component.AppComponent;
import com.yuyh.easyadapter.glide.GlideCircleTransform;

import butterknife.Bind;
import butterknife.OnClick;

public class ProfileActivity extends BaseActivity {

    @Bind(R.id.iv_profile_iv)
    ImageView mPortraitIV;
    @Bind(R.id.et_profile_nickname)
    EditText mNicknameTV;
    @Bind(R.id.tv_profile_gender)
    TextView mGenderTV;
    @Bind(R.id.tv_profile_birth)
    TextView mBirthTV;

    User mUser;

    public static void startActivity(Context context) {
        Intent intent = new Intent(context, ProfileActivity.class);
        context.startActivity(intent);
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_profile;
    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {

    }

    @Override
    public void initToolBar() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void configViews() {
        mUser = LoginManager.getInstance().getUser();
        if (mUser != null) {
            Glide.with(this).load(mUser.portrait).centerCrop().bitmapTransform(new GlideCircleTransform(this)).into(mPortraitIV);
            mNicknameTV.setText(mUser.nickname);
            mGenderTV.setText(mUser.gender);
            if (!TextUtils.isEmpty(mUser.age)) {
                mBirthTV.setText(mUser.age);
            }

        }
//        hideStatusBar();
    }

    @OnClick(R.id.tv_profile_cancel)
    public void cancel() {
        finish();
    }

    @OnClick(R.id.tv_profile_send)
    public void send() {
        finish();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

}
